package com.wangan.wanganpush.utils;

import com.wangan.wanganpush.dao.ParamDao;
import com.wangan.wanganpush.model.Parameter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * 生成文件名
 */



@Service
public class FileNameParse {

    @Autowired
    ParamDao paramDao;

    @Autowired
    AtomicValue atomicValue;

    private static String applicationCoding = "1520030";


    /**
     * 根据传入的业务类型拼接文件名
     * serviceType:业务类型
     * fileType：消息类型
     *
     * @return
     */
    public  String parseFileName(String serviceType,String fileType,String messageCode){
        try {
            StringBuffer sb = new StringBuffer();
            sb.append(applicationCoding);
            sb.append("_"+serviceType);
            sb.append("_"+fileType);
            sb.append("_"+messageCode);
            sb.append("_"+0);
            sb.append("_000"+atomicValue.getAtuo());
            // sb.append("_V2");

            System.out.println(sb.toString());
            return sb.toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }

    }


    /**
     * 拿取消息流水号
     */
    public  String  getMessageCode(){
       return "310107"+System.currentTimeMillis();
    }

//    public static void main(String[] args) {
//        parseFileName("account",3+"");
//    }

}
